#ifndef _VOM_MODULE_MANAGER_HEADER_
#define _VOM_MODULE_MANAGER_HEADER_

#include "sys/string.h"
#include "sys/sysapi.h"
#include "sys/ptr.h"

class LoadingManager;
class ObjectModel
{
public:
	typedef vclsid (*GetAddinClassFuncPtr)();
	typedef std::map<String,HMODULE> ComponentMap;
	typedef std::map<String,sys::ObjectPtr> AddinMap;
	typedef std::map<vclsid,CreateObjectFuncPtr> CreatorMap;

public:
	ObjectModel();
	~ObjectModel();

	vresult RegisterComponent(const wchar_t* wsComponentName);
	IObject* LoadAddin(const wchar_t* modulePath);
	void UnloadAddin(const wchar_t* modulePath);
	void UnloadAllComponents();

	void RegisterCreator(vclsid clsid,CreateObjectFuncPtr func);
	vresult	CreateObject(vclsid clsID,IObject** ppObject);
	void ClearAll();
	LoadingManager* GetLoaderManager(const String& inifilename);

private:
	ComponentMap	m_modules;
	AddinMap m_addins;
	CreatorMap	m_creators;
	LoadingManager* m_loaderManager;
};

#endif
